package com.lyr.tranfimg.controller;

import com.lyr.tranfimg.service.TransferImgService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liyiruo
 * @Description
 * @Date 2024/10/29 14:47
 */
@RestController
@RequestMapping("/show")
@CrossOrigin
public class MyController {

    private static final Logger logger = LoggerFactory.getLogger(MyController.class);


    private final TransferImgService transferImgService;
    public MyController(TransferImgService transferImgService) {
        this.transferImgService = transferImgService;
    }


    @RequestMapping("/img")
    public String doService(String id) {
        long now=System.currentTimeMillis();
        logger.info("当前时间：{}接收到的参数id=>{}", now,id);
        if (null != id && !id.isEmpty()) {
            transferImgService.findAndCopyAndDelete(id);
        }
        logger.info("结束时间：{}接收到的参数id=>{}", System.currentTimeMillis(),id);
        return "处理完毕 : "+id;
    }


}
